package strategy;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

/**
 * 信用卡支付策略实现类
 */
@Component("creditCardPayment")
public class CreditCardPayment implements PaymentStrategy {
    private String cardNumber;
    private String expiryDate;
    private String cvv;

    public CreditCardPayment(
            @Value("${payment.creditcard.number:1234-5678-9012-3456}") String cardNumber,
            @Value("${payment.creditcard.expiry:12/25}") String expiryDate,
            @Value("${payment.creditcard.cvv:123}") String cvv) {
        this.cardNumber = cardNumber;
        this.expiryDate = expiryDate;
        this.cvv = cvv;
    }

    @Override
    public void pay(double amount) {
        System.out.println("使用信用卡支付：¥" + amount);
        System.out.println("卡号：" + cardNumber);
        System.out.println("支付完成！");
    }
}